<template>
	<view>
		<view class="counter">
			{{counter}}
		</view>
		<view>
			<button type="default" @click="add(1)" class="btnadd">加一</button>
		</view>
	</view>
</template>

<script>
	import {
		日历
	} from '../../utils/index'
	export default {
		data() {
			return {
				counter: 0,
				key: null
			};
		},
		created() {
			let t = new 日历(new Date())
			this.key = "" + t.公历年 + t.公历月 + t.公历日
			this.counter = Number(uni.getStorageSync(this.key))
		},
		methods: {
			add(param) {
				this.counter += param

				uni.setStorageSync(this.key, this.counter)
			}
		}
	}
</script>

<style lang="less">
	.counter {
		font-size: 45px;
		text-align: center;
		line-height: 400px;
		height: 400px;
	}

	.btnadd {
		width: 70vw;
		height: 100px;
		line-height: 100px;
		font-size: 32px;
	}
</style>
